<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        /* JavaScript没块级作用域*/
        // if(true){
        //     var color="blue"
        // }
        // alert(color);
        function add(num1,num2){
            sum=num1+num2;
            return sum;

        }
        var result=add(10,20)
        console.log(result)
        alert(sum)
    </script>
</body>
</html>